package com.ezops.poc.util;

import java.io.File;
import java.io.IOException;
import java.util.Scanner;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;

import org.xml.sax.SAXException;

public class ClientFieldQueryGenerator {
	static String query = "INSERT INTO EZOPSDB.CLIENT_FIELDS(FIELD_NAME,CLIENT_ID,ASSET_ID) VALUES ('%s',1,%d); ;";

	public static void main(String[] args) throws SAXException, IOException,
			ParserConfigurationException, TransformerException {

		Scanner scanner = new Scanner(new File("CITI_BOND_FIELDS.csv"));
		int value = 1;
		while (scanner.hasNextLine()) {
			String fields = scanner.nextLine();
			String[] fieldArray = fields.split(",");

			for (String fieldName : fieldArray)
				System.out.println(String.format(query, fieldName, value));
			value++;
		}
	}

}
